csspositionvalue: make empty error value non fatal
authorCosimo Cecchi <cosimoc@gnome.org>
Sat, 12 May 2012 00:46:18 +0000 (20:46 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 15 May 2012 17:24:40 +0000 (13:24 -0400)
If there's just no value to parse (e.g. because we're parsing a
shorthand property), don't error out while trying to parse a number.

gtk/gtkcsspositionvalue.c

index 61c34f31624516a54fa324e0eefab3c20f980834..fd230ed917b1b9d0094f009c50e7a13d2ff930fd 100644 (file)
@@ -187,12 +187,18 @@ _gtk_css_position_value_parse (GtkCssParser *parser)
     }
   if (names[first].name == NULL)
     {
-      missing = &y;
-      x = _gtk_css_number_value_parse (parser,
-                                       GTK_CSS_PARSE_PERCENT
-                                       | GTK_CSS_PARSE_LENGTH);
-      if (x == NULL)
-       return NULL;
+      if (_gtk_css_parser_has_number (parser))
+        {
+          missing = &y;
+          x = _gtk_css_number_value_parse (parser,
+                                           GTK_CSS_PARSE_PERCENT
+                                           | GTK_CSS_PARSE_LENGTH);
+
+          if (x == NULL)
+            return NULL;
+        }
+      else
+        return NULL;
     }
 
   for (second = 0; names[second].name != NULL; second++)